/*
 * @Description: 装配图管理接口
 * @Author: Huang Junjie
 * @Date: 2021-09-15 12:18:23
 * @LastEditTime: 2021-09-28 12:36:37
 * @LastEditors: Huang Junjie
 */
import request from '@/utils/request'

// 查询列表信息
export function getListPage(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcwAssembly/pageData') : '/jcwBasic/jcwAssembly/pageData',
    method: 'GET',
    params: params
  })
}

// 根据id查询信息
export function getInfoById(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + `/jcwAssembly/getById`) : `/jcwBasic/jcwAssembly/getById`,
    method: 'GET',
    params: params
  })
}

// 新增/修改信息
export function addOrEditData(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcwAssembly/saveOrUpdateData') : '/jcwBasic/jcwAssembly/saveOrUpdateData',
    method: 'POST',
    data: params
  })
}

// 删除信息
export function deleteData(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + `/jcwAssembly/${params.id}`) : `/jcwBasic/jcwAssembly/${params.id}`,
    method: 'DELETE'
  })
}

// 查询零部件清单信息列表
export function getPartListPage(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcwAssemblyParts/pageData') : '/jcwBasic/jcwAssemblyParts/pageData',
    method: 'GET',
    params: params
  })
}

// 保存零部件清单
export function partAddOrEditData(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcwAssemblyParts/saveOrUpdateData') : '/jcwBasic/jcwAssemblyParts/saveOrUpdateData',
    method: 'POST',
    data: params
  })
}
